package adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.TextureView
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.example.hospitalmanagementapp.PeopleInformationModel
import com.example.hospitalmanagementapp.R

class ReportAdapter(context: Context): RecyclerView.Adapter<ReportAdapter.ReportViewHolder>() {
  private val context:Context=context
  lateinit var  dataList:MutableList<PeopleInformationModel>
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ReportViewHolder {
        return ReportViewHolder(LayoutInflater.from(context).inflate(R.layout.report_item,parent,false))
    }

    override fun onBindViewHolder(holder: ReportViewHolder, position: Int) {
        holder.reportName.text=dataList[position].information
        holder.reportNumber.text=dataList[position].data
    }

    override fun getItemCount(): Int {
       return if (dataList.size==null) 0 else dataList.size
    }
    inner class ReportViewHolder(itemView:View):RecyclerView.ViewHolder(itemView){
     val reportName=itemView.findViewById<TextView>(R.id.report_name)
     val reportNumber=itemView.findViewById<TextView>(R.id.report_id_number)
    }
}